local skynet = require "skynet"
local ws_client = require "ws.ws_client"

local proto = require "common.proto"
local sproto = require "sproto"

local host = sproto.new(proto.s2c):host "package"
local request = host:attach(sproto.new(proto.c2s))

local ws

local function send_package(msg,pack)
    print("send_package ",msg)
	local package = string.pack(">s2",request(msg,pack))
	ws:send_binary(package)
end


skynet.start(function()

   ws = ws_client.new()
   ws:connect("ws://127.0.0.1:8030/game?token=TVRJME1EVT06VjJwT1YySkhUWHBVYlZwT1ZrVnJkMVJWVWxaUVZVSmhUVEZhYzFsNlRrNVFVMDVoVWtWc2VWWldWa2RUUmxsM1dYcEdWRkl5VFRVPQ==")
   print("connect:",ws:recv_frame())
    send_package("activityList",{})
   print("activityList:",ws:recv_frame())


	-- skynet.exit()
end)

